package com.hl.ruoyilkshop.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hl.ruoyilkshop.mapper.BusinessUserRelationMapper;
import com.hl.ruoyilkshop.domain.BusinessUserRelation;
import com.hl.ruoyilkshop.service.IBusinessUserRelationService;

/**
 * 商家用户关联Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-08-08
 */
@Service
public class BusinessUserRelationServiceImpl implements IBusinessUserRelationService 
{
    @Autowired
    private BusinessUserRelationMapper businessUserRelationMapper;

    /**
     * 查询商家用户关联
     * 
     * @param id 商家用户关联主键
     * @return 商家用户关联
     */
    @Override
    public BusinessUserRelation selectBusinessUserRelationById(Long id)
    {
        return businessUserRelationMapper.selectBusinessUserRelationById(id);
    }

    /**
     * 查询商家用户关联列表
     * 
     * @param businessUserRelation 商家用户关联
     * @return 商家用户关联
     */
    @Override
    public List<BusinessUserRelation> selectBusinessUserRelationList(BusinessUserRelation businessUserRelation)
    {
        return businessUserRelationMapper.selectBusinessUserRelationList(businessUserRelation);
    }

    /**
     * 根据用户ID查询默认商家关联
     * 
     * @param userId 用户ID
     * @return 商家用户关联
     */
    @Override
    public BusinessUserRelation selectDefaultBusinessByUserId(Long userId)
    {
        return businessUserRelationMapper.selectDefaultBusinessByUserId(userId);
    }

    /**
     * 根据用户ID查询所有商家关联
     * 
     * @param userId 用户ID
     * @return 商家用户关联集合
     */
    @Override
    public List<BusinessUserRelation> selectBusinessListByUserId(Long userId)
    {
        return businessUserRelationMapper.selectBusinessListByUserId(userId);
    }

    /**
     * 新增商家用户关联
     * 
     * @param businessUserRelation 商家用户关联
     * @return 结果
     */
    @Override
    public int insertBusinessUserRelation(BusinessUserRelation businessUserRelation)
    {
        businessUserRelation.setCreateTime(DateUtils.getNowDate());
        return businessUserRelationMapper.insertBusinessUserRelation(businessUserRelation);
    }

    /**
     * 修改商家用户关联
     * 
     * @param businessUserRelation 商家用户关联
     * @return 结果
     */
    @Override
    public int updateBusinessUserRelation(BusinessUserRelation businessUserRelation)
    {
        businessUserRelation.setUpdateTime(DateUtils.getNowDate());
        return businessUserRelationMapper.updateBusinessUserRelation(businessUserRelation);
    }

    /**
     * 批量删除商家用户关联
     * 
     * @param ids 需要删除的商家用户关联主键
     * @return 结果
     */
    @Override
    public int deleteBusinessUserRelationByIds(Long[] ids)
    {
        return businessUserRelationMapper.deleteBusinessUserRelationByIds(ids);
    }

    /**
     * 删除商家用户关联信息
     * 
     * @param id 商家用户关联主键
     * @return 结果
     */
    @Override
    public int deleteBusinessUserRelationById(Long id)
    {
        return businessUserRelationMapper.deleteBusinessUserRelationById(id);
    }
}
